﻿package game.account.friends {
	import game.objects.GameObject;
	import game.objects.UserObject;
	import flash.geom.Rectangle;
	import game.ui.Image;
	import flash.events.MouseEvent;
	import flash.events.Event;
	import game.ui.Button;
	
	public class Friend extends GameObject {
		
		private var image:Image;
		
		public function Friend(data:UserObject):void {
			
			image = new Image ((data && data.photo) ? data.photo : config.host + config.friends.urlEmpty, this.width-10, this.height-10, 10);
			image.x = image.y = 5;
			addChildAt(image, 1);
			
			image.addEventListener ( MouseEvent.ROLL_OVER,	mOver );
			image.addEventListener ( MouseEvent.ROLL_OUT,	mOut );
			
			image.addEventListener(Event.COMPLETE, function (event:Event) { image.blackAndWhite(); });
			
			if (data && data.photo) {
				
			} else {
				btnInfo.visible = false;
			}
		}
		
		private function mOver(event:MouseEvent):void {
			image.color();
		}
		
		private function mOut(event:MouseEvent):void {
			image.blackAndWhite();
		}
		
	}
}